﻿'========================================================================
'功能:申請MVPN//IT
'作者:andy
'日期:2011/6/10
'========================================================================
Imports System.Data
Partial Class WebForm_SysParam_ApproveApplyIT
    Inherits BasePage
    'Public Overrides Function SaveFormInfo() As Boolean
    '    ''送往FlowER
    '    Try
    '        Dim appDao As Telecom.DAO.ApplyDAO = New Telecom.DAO.ApplyDAO(hidbName.Value)
    '        appDao.UpdateData(Integer.Parse(txtFormNo.Text), txtApplicant.Text, txtFiller.Text, txtApplyExt.Text, txtFillerExt.Text, ddlExtKind.SelectedValue, ddlsuit_site.SelectedValue, ddltype_code.SelectedValue, ddlNetworkType.SelectedValue, txtTelNo.Text, ddlApplyItem.SelectedValue, ddlDialType.SelectedValue, txtFactoryName.Text, txtName2.Text, txtTelNo2.Text, "1", txtTelNo3.Text, txtName3.Text, txtApplyMemo.Text, txtShortCode.Text, txtIDNo.Text, txtIDNo2.Text, txtIDNo3.Text)
    '        Return True
    '    Catch ex As Exception
    '        Return False
    '    End Try

    'End Function
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hiUID.Value = ActualUID
            hidbName.Value = dbName

            txtFormNo.Text = Request.QueryString("FormNo")
            GetData()
        End If
    End Sub

    Private Sub GetData()
        Dim appDao As Telecom.DAO.ApplyDAO = New Telecom.DAO.ApplyDAO(hidbName.Value)
        Dim dt As DataTable = appDao.GetMVPNApplyByFlowerFormNo(Request.QueryString("FormNo"))
        If dt.Rows.Count = 0 Then
            Exit Sub
        End If
        If dt.Rows(0)("Applicant").ToString = "" Then
            Return
        End If
        txtFormNo.Text = dt.Rows(0)("FormNo").ToString
        txtIDNo.Text = dt.Rows(0)("IDNo").ToString
        txtIDNo2.Text = dt.Rows(0)("IDNo2").ToString
        txtIDNo3.Text = dt.Rows(0)("IDNo3").ToString
        txtFormNo.Text = dt.Rows(0)("FormNo").ToString
        txtApplicant.Text = dt.Rows(0)("Applicant").ToString
        txtApplyName.Text = dt.Rows(0)("ApplyName").ToString
        txtFiller.Text = dt.Rows(0)("Filler").ToString
        txtApplyExt.Text = dt.Rows(0)("ApplyExt").ToString
        txtFillerExt.Text = dt.Rows(0)("FillerExt").ToString
        txtApplyDate.Text = DateTime.Parse(dt.Rows(0)("ApplyDate").ToString).ToString("yyyy/MM/dd HH:mm:ss")
        ddlExtKind.SelectedValue = dt.Rows(0)("ExtKind").ToString
        ddlsuit_site.DataBind()
        ddlsuit_site.SelectedValue = dt.Rows(0)("ApplyFactoryID").ToString
        ddltype_code.DataBind()
        ddltype_code.Text = dt.Rows(0)("ApplyType").ToString
        ddlNetworkType.DataBind()
        ddlNetworkType.Text = dt.Rows(0)("NetworkType").ToString
        txtTelNo.Text = dt.Rows(0)("TelNo").ToString
        ddlApplyItem.DataBind()
        ddlApplyItem.SelectedValue = dt.Rows(0)("ApplyItem").ToString
        ddlDialType.DataBind()
        ddlDialType.SelectedValue = dt.Rows(0)("DialType").ToString

        txtFactoryName.Text = dt.Rows(0)("FactoryName").ToString
        txtName2.Text = dt.Rows(0)("Name2").ToString
        txtTelNo2.Text = dt.Rows(0)("TelNo2").ToString
        txtTelNo3.Text = dt.Rows(0)("TelNo3").ToString
        txtName3.Text = dt.Rows(0)("Name3").ToString
        txtApplyMemo.Text = dt.Rows(0)("ApplyMemo").ToString
        txtShortCode.Text = dt.Rows(0)("ShortCode").ToString

        If ddltype_code.SelectedValue = "1" Then
            trComanyData.Visible = False
            trComanyTitle.Visible = False
            trFamilyData.Visible = False
            trFamilyTitle.Visible = False
        End If
        If ddltype_code.SelectedValue = "2" Then
            trComanyData.Visible = False
            trComanyTitle.Visible = False
            trFamilyData.Visible = True
            trFamilyTitle.Visible = True
        End If
        If ddltype_code.SelectedValue = "3" Then
            trComanyData.Visible = True
            trComanyTitle.Visible = True
            trFamilyData.Visible = False
            trFamilyTitle.Visible = False
        End If
        If ddltype_code.SelectedValue = "4" Then
            trComanyData.Visible = False
            trComanyTitle.Visible = False
            trFamilyData.Visible = False
            trFamilyTitle.Visible = False
        End If
        If ddltype_code.SelectedValue.Trim = "" Then
            trComanyData.Visible = False
            trComanyTitle.Visible = False
            trFamilyData.Visible = False
            trFamilyTitle.Visible = False
        End If
    End Sub




    
    
   


    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim appDao As Telecom.DAO.ApplyDAO = New Telecom.DAO.ApplyDAO(hidbName.Value)
        appDao.UpdateData(Integer.Parse(txtFormNo.Text), txtApplicant.Text, txtFiller.Text, txtApplyExt.Text, txtFillerExt.Text, ddlExtKind.SelectedValue, ddlsuit_site.SelectedValue, ddltype_code.SelectedValue, ddlNetworkType.SelectedValue, txtTelNo.Text, ddlApplyItem.SelectedValue, ddlDialType.SelectedValue, txtFactoryName.Text, txtName2.Text, txtTelNo2.Text, "0", txtTelNo3.Text, txtName3.Text, txtApplyMemo.Text, txtShortCode.Text, txtIDNo.Text, txtIDNo2.Text, txtIDNo3.Text)

    End Sub

   
    Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click

        
        Dim appDao As Telecom.DAO.ApplyDAO = New Telecom.DAO.ApplyDAO(hidbName.Value)
        appDao.UpdateData(Integer.Parse(txtFormNo.Text), txtApplicant.Text, txtFiller.Text, txtApplyExt.Text, txtFillerExt.Text, ddlExtKind.SelectedValue, ddlsuit_site.SelectedValue, ddltype_code.SelectedValue, ddlNetworkType.SelectedValue, txtTelNo.Text, ddlApplyItem.SelectedValue, ddlDialType.SelectedValue, txtFactoryName.Text, txtName2.Text, txtTelNo2.Text, "1", txtTelNo3.Text, txtName3.Text, txtApplyMemo.Text, txtShortCode.Text, txtIDNo.Text, txtIDNo2.Text, txtIDNo3.Text)
        
        ''送往FlowER
        Dim formNo As Integer = Integer.Parse(txtFormNo.Text)
        ' Dim formMVPN As MVPN.Manager.FromMVPNRemote = New MVPN.Manager.FromMVPNRemote(Me)
        'formMVPN.send(formNo, "Approve")
        Response.Redirect(System.Configuration.ConfigurationManager.AppSettings("ApplyReturnPath"))
    End Sub

    
    Protected Sub btnOthNo1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOthNo1.Click
        OtherTelNo1.Visible = True
        OtherTelNo1.InitDataAndShow(Integer.Parse(txtFormNo.Text), "A")
    End Sub
End Class




